import { createRouter, createWebHistory ,createWebHashHistory} from 'vue-router'
import index from '../pages/index/index.vue'
const routes = [
  {
    path: '/',
    redirect: '/root',
  },
  {
    path: '/root',
    name: 'root',
    component: index,
    children: [
      // {    // 等效于 外层的  redirect: '/root/child1',
      //   path:'',
      //   redirect:'child1'
      // },
      {
        path: 'child1',  // 等效于'/root/child1'
        name: 'child1',
        component: index,
        redirect: '/root/child1/child3',
        children:[
          {
            path: 'child3', // 等效于'/root/child1/child3'
            name: 'child3',
            component: index,
          }
        ]
      }
    ]
  }
]


const router = createRouter({
  history: createWebHashHistory(),
  routes
})
export default router
